//
//  SVProgressHUD+CLCategory.m
//  CLBrowser
//
//  Created by chuck on 2021/7/3.
//

#import "SVProgressHUD+CLCategory.h"

@implementation SVProgressHUD (CLCategory)
+ (void)showHUDMsg:(NSString *)msg duration:(NSTimeInterval)duration {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
    //设置HUD和文本的颜色
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    //设置HUD背景颜色
    [SVProgressHUD setBackgroundColor:HEXRGBALPHA(0x000000, 0.6)];
    [SVProgressHUD showImage:nil status:msg];
    [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, SCREENHEIGHT/2 * 0.75)];
    [SVProgressHUD dismissWithDelay:duration completion:^{
        [SVProgressHUD setOffsetFromCenter:UIOffsetZero];
    }];
#pragma clang diagnostic pop
}

+ (void)showLoading {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
    //设置HUD和文本的颜色
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    //设置HUD背景颜色
    [SVProgressHUD setBackgroundColor:HEXRGBALPHA(0x000000, 0.6)];
    
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeNone];
    [SVProgressHUD show];
#pragma clang diagnostic pop
}

+ (void)showTopHUDMsg:(NSString *)msg duration:(NSTimeInterval)duration {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"
    //设置HUD和文本的颜色
    [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
    //设置HUD背景颜色
    [SVProgressHUD setBackgroundColor:HEXRGBALPHA(0x000000, 0.6)];
    [SVProgressHUD showImage:nil status:msg];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
    [SVProgressHUD setOffsetFromCenter:UIOffsetMake(0, NAVBAR_HEIGHT)];
#pragma clang diagnostic pop
    [SVProgressHUD dismissWithDelay:duration completion:^{
        [SVProgressHUD setOffsetFromCenter:UIOffsetZero];
    }];
#pragma clang diagnostic pop
}

@end
